<template>
  <div class="org-class">
    <organization-chart :datasource="ds">
      <template slot-scope="{ nodeData }">
        <el-card class="box-card">
          <el-row class="top">
            <div class="node-title">{{ nodeData.title }}</div>
          </el-row>
          <el-row class="bottom">
            <img class="btn" src="/static/img/add.png">
            <img class="btn" src="/static/img/minus.png">
            <img class="btn" src="/static/img/edit.png">
            <img class="btn" src="/static/img/user.png">
          </el-row>
        </el-card>
      </template>
    </organization-chart>
  </div>
</template>
<style scoped>
.btn {
  width: 25px;
}
.top {
  height: 60%;
  background-color: white;
}
.bottom {
  height: 40%;
  background-color: white;
}
.box-card /deep/ .el-card__body {
  width: 100%;
  height: 80px;
  padding: 0px;
}
.org-class .orgchart-container{
  height: 100%;
  width: 100%;
}
</style>
<script>
import OrganizationChart from 'vue-organization-chart'
import 'vue-organization-chart/dist/orgchart.css'
export default {
  components: { OrganizationChart },
  data() {
    return {
      ds: {
          'id': '1',
          'name': 'Lao Lao',
          'title': 'general manager',
          'children': [
            { 'id': '2', 'name': 'Bo Miao', 'title': 'department manager' },
            { 'id': '3', 'name': 'Su Miao', 'title': 'department manager',
              'children': [
                { 'id': '4', 'name': 'Tie Hua', 'title': 'senior engineer' },
                { 'id': '5', 'name': 'Hei Hei', 'title': 'senior engineer',
                  'children': [
                    { 'id': '6', 'name': 'Pang Pang', 'title': 'engineer' },
                    { 'id': '7', 'name': 'Xiang Xiang', 'title': 'UE engineer' }
                  ]
                 }
               ]
             },
            { 'id': '8', 'name': 'Hong Miao', 'title': 'department manager' },
            { 'id': '9', 'name': 'Chun Miao', 'title': 'department manager' }
          ]
        }
    }
  }
}
</script>
